package com.thinkgem.jeesite.modules.sys.service;

import com.thinkgem.jeesite.modules.sys.dao.TbOrderProductMapper;
import com.thinkgem.jeesite.modules.sys.entity.TbOrderProduct;
import com.thinkgem.jeesite.modules.sys.entity.TbOrderProductExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by jyy on 2016/10/19 0019.
 */
@Service

public class TbOrderProductService {

    @Autowired
    private TbOrderProductMapper tbOrderProductMapper;
    @Transactional(readOnly = true)
    public TbOrderProduct queryTbOrderProduct(Integer id){
        return tbOrderProductMapper.selectByPrimaryKey(id);
    }

    @Transactional(readOnly = true)
    public TbOrderProduct queryTbOrderProductByOrderId(Integer orderId){
        return tbOrderProductMapper.selectByPrimaryOrderId(orderId);
    }
    @Transactional(readOnly = true)
    public List<TbOrderProduct> queryTbOrderProducts(Integer orderId){
        return tbOrderProductMapper.queryListOrderProduct(orderId);
    }

    public void insert(TbOrderProduct tbOrderProduct){
        tbOrderProductMapper.insert(tbOrderProduct);
    }

    /**
     * 通过订单号查找订单详情
     */

    @Transactional(readOnly = true)
    public List<TbOrderProduct> queryTbOrderProductsByOrderNo(String orderNo){
        return tbOrderProductMapper.queryTbOrderProductsByOrderNo(orderNo);
    }

}
